# 简化形式：可以省略成员属性定义,但仍可调用
class Student:

    def __init__(self, name, sex, age):
        self.name = name  # 姓名
        self.sex = sex  # 性别
        self.age = age  # 年龄
        print("构造函数执行了")

    def __str__(self):
        return f"姓名：{self.name}，年龄：{self.age}"

    def __le__(self, other):
        return self.age <= other.age


# 创建对象并赋值
stu_1 = Student("李白", "男", 1000)
print(stu_1.name)
print(stu_1.sex)
print(stu_1.age)

print(stu_1)

stu_2 = Student("李白", "男", 10)
print(stu_1 <= stu_2)
print(stu_2 <= stu_1)
